﻿using System;
using System.Linq;
using ilgolosone.DomainModel.Entities;
using ilgolosone.DomainModel.Queries;
using ilgolosone.DomainModel.Repositories;
using ilgolosone.Persistence.NH.Data;
using ilgolosone.Persistence.NH.Data.Impl;

namespace ilgolosone.Persistence.NH.Repositories
{
    public class ReservationRepository : NHibernateRepository<Reservation>, IReservationRepository
    {
        public ReservationRepository(INHibernateUnitOfWork unitOfWork) 
            : base(unitOfWork)
        { }

        public Reservation[] GetReservationsByTime(DateTime startTime, DateTime endTime)
        {
            var reservationByDateFilter = new FindReservationByDate(startTime);

            return this.Filter(reservationByDateFilter).ToArray();
        }
    }
}
